/**
 * Copyright (c) Enalean, 2018. All Rights Reserved.
 *
 * This file is a part of Tuleap.
 *
 * Tuleap is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Tuleap is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tuleap. If not, see <http://www.gnu.org/licenses/>.
 */

$codemirror-like-line-numbers-color: #8c8c8c;
$gitphp-code-font: normal normal 14px / 20px monospace;

.git-repository-blob-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid $tlp-ui-border-light;

    > .git-repository-blob-header-title {
        margin: 0;
        font-size: 20px;
        font-weight: 400;

        > a {
            color: inherit;
        }
    }
}

.git-repository-blob-header-actions {
    display: flex;
}

.git-repository-blob-header-plain,
.git-repository-blob-header-actions-bar,
.git-repository-blob-header-history-datatag {
    margin: 0 0 0 $tlp-spacing;
}

.git-repository-blob-body {
    overflow-x: auto;
    overflow-y: hidden;
    background: $tlp-theme-color-dimmed-background;
}

.git-repository-blob-image {
    padding: $tlp-spacing;
    text-align: center;
}

#git-repository-blob-file,
#git-repository-blame-file {
    display: flex;
    width: 100%;
    background: $tlp-ui-white;
    font: $gitphp-code-font;
    line-height: 1.5;
}


.git-repository-blob-file-code,
.git-repository-blob-file-linenumbers {
    border: 0;
    font: $gitphp-code-font;
}

.git-repository-blob-file-linenumbers {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding: 5px 0;
    border-right: 1px solid $tlp-ui-border-light;
    background: mix($tlp-theme-background-color, $tlp-ui-white, 50%);
    line-height: 1.5;
    text-align: right;
    vertical-align: top;
}

.git-repository-blob-file-linenumbers-line {
    width: 100%;
    padding: 0 $tlp-half-spacing;
    color: $codemirror-like-line-numbers-color;

    &:target {
        background: transparentize($tlp-theme-color, .5);
        color: $tlp-ui-white;
    }

    &:hover {
        background: $tlp-theme-color;
        color: $tlp-ui-white;
        text-decoration: none;
    }
}

$under-code: 1;
$above-highlight-line: 2;

.git-repository-blob-file-code {
    position: relative;
    width: 100%;
    padding: 5px $tlp-half-spacing;
    background: none;
    color: $tlp-typo-default-text-color;
    font: $gitphp-code-font;
    line-height: 1.5;

    &[class*="language-"] {
        margin: 0;
        padding: 5px $tlp-half-spacing;
        background: none;
    }

    > code[class*="language-"] {
        position: relative;
        z-index: $above-highlight-line;
        font: $gitphp-code-font;
        text-shadow: none;
    }
}

.git-repository-highlight-line {
    display: none;
    position: absolute;
    width: 100%;
    margin-left: -10px;
    background: linear-gradient(to right, transparentize($tlp-theme-color, .95) 60%, transparent 70%);

    &.shown {
        display: block;
        z-index: $under-code;
    }
}

.git-repository-blob-diff-header-link {
    margin: 0 $tlp-half-spacing 0 0;
}

.git-repository-blame-line {
    padding: 5px $tlp-half-spacing;
    border-right: 1px solid $tlp-ui-border-light;
    background: mix($tlp-theme-background-color, $tlp-ui-white, 50%);
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

.git-repository-blame-linenumbers {
    vertical-align: top;
}

.git-repository-blame-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}
